package string;

public class MatchesDemo {
    public static void main(String[] args) {
        /*
        * 邮箱正则表达式：
        *   [a-zA-Z0-9_]+@[a-zA-Z0-9]+(\.[a-zA-Z]+)+
        * */

        String email = "xiuMi ngDaShaZi@hahaa.xiha";
        String regex = "[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
        Boolean result = email.matches(regex);
        if(result) {
            System.out.println("格式正确");
        } else {
            System.out.println("格式错误");
        }
    }
}
